<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=1.0"/>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="telephone=no" name="format-detection"/>
    <title>忘记密码</title>
    <link rel="stylesheet" href="css/H-ui.reset.css">
    <link rel="stylesheet" href="css/tongyong.css">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/alert.css">
    <link rel="stylesheet" href="css/myStyle.css">
</head>
<body>
	
	<div class="setting_div">
		<a href="passwd_setting.html"><img class="back_img" src="images/back.png"></a>
		<span>忘记密码</span>
	</div>
	
	<p class="setting_top_line"></p>
	<div class="setpwd_div">
		<label>手机号码 </label>
		<input id="phoneNo" type="text" maxlength="11" placeholder="请输入正确的手机号">
	</div>
	
	<p class="setting_top_line"></p>
	
	<div class="getCaptcha_div"><button class="getCaptcha_btn" id="getCode">获取验证码</button></div>
	
	<script src="//cdn.bootcss.com/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="js/config.js"></script>
	<script type="text/javascript" src="js/alert.js"></script>
	<script type="text/javascript">
		//发送验证码功能
		$("#getCode").click(function(){
			var phoneNo = $("#phoneNo").val();
			var status = "0";   // 0注册  1登陆
			//合法性检查
			if (phoneNo == null || phoneNo.length == 0) {
				alert("手机号不能为空");
				return false; 
			}
			var myreg = /^(((13[0-9]{1})|(14[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/; 
			if(!myreg.test(phoneNo)) 
			{ 
			    alert('请输入有效的手机号码！'); 
			    return false; 
			}
			
			var data = {
						"params": {
			       			 phoneNo: phoneNo,
			       			 status: status
			   			 }
				   	}
			var jsonData = JSON.stringify(data);
			$.ajax({
				url: urlLink + "/bMaMarketCustInfo/phoneCaptcha",
				type: "POST",
				contentType: "application/json; charset=utf-8",
				data:jsonData,
				success: function(data){
					if (data.code == "0000") {
						alert("发送验证码成功");
						localStorage.setItem("mobileNo", phoneNo);
						window.location.href = "passwd_reset.html";
					}else{
						alert(data.msg);
					}
					
				},
				error: function(data){
					alert("服务器繁忙");
				}
			})
			
	});
	</script>
	
	
</body>
</html>
